export default {
	// 系统提示
	$msg: (title, mask = true, icon) => {
		uni.showToast({
			title,
			icon: 'none',
			mask, // 阻止穿透
			duration: 2000
		});
	},
	$showModal:({title,content})=>{
		return new Promise((ok)=>{
			uni.showModal({
			    title,
			    content,
			    success: function (res) {
			        if (res.confirm) {
			            ok(true)
			        } else if (res.cancel) {
			            ok(false)
			        }
			    }
			});
		})
	},
	// 路由跳转
	$goPage(url, type = 'page') {
		let routers = {
			page: () => {
				uni.navigateTo({
					url
				});
			},
			tab: () => {
				uni.switchTab({
					url
				});
			},
			redirect: () => {
				uni.redirectTo({
					url
				});
			}
		}
		routers[type]()
	}
}
